
var app = getApp();
var ApiUrl = app.globalData.ApiUrl;
Page({

  /**
   * 页面的初始数据
   */
  data: {
    point:0,
    signin_list:[]
  },
  //获取积分牧草
  add_my_asset(obj) {
    let that = this;
    let k = wx.getStorageSync('key');
    wx.request({
      url: ApiUrl + '/index.php?act=member_index&op=my_asset',
      data: {
        key: k,
        fields: obj
      },
      header: {
        'content-type': 'application/x-www-form-urlencoded'
      },
      success: function (result) {
//console.log('获取余额/红包/券/牧草积分:==>', result);
        if (result.statusCode == 200) {
          if (result.data.code == 200) {
            let available_rc = result.data.datas[obj];
            that.setData({
              [obj]: available_rc
            })
          }
        }
      }
    });
  },
  //牧草日志记录
  signin_list() {
    let that = this;
    let k = wx.getStorageSync('key');
    wx.request({
      url: ApiUrl + '/index.php?act=member_points&op=pointslog',
      data: {
        key: k
      },
      header: {
        'content-type': 'application/x-www-form-urlencoded'
      },
      success: function (result) {
        console.log('牧草日志记录:==>', result);
        if (result.statusCode == 200) {
          if (result.data.code == 200) {
            let available_rc = result.data.datas.log_list ;
            that.setData({
              signin_list: available_rc
            })
          }
        }
      }
    });
  },


  /**
   * 生命周期函数--监听页面加载
   */


  onLoad: function (options) {
    this.add_my_asset('point');
    this.signin_list();
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
  
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  }
})

